@import "../../style/global.scss";

$rootName: x-search-bar;

.#{$rootName} {
    width: 710px;
    height: 64px;
    margin: 0 auto;
    border-radius: 10px;
    white-space: nowrap;
    display: flex;
    overflow: hidden;

    .#{$rootName}-search {
        width: 710px;
        height: 64px;
        position: relative;
        background: #F5F5F5;
        border-radius: 10px;
        transition: .3s width;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

        &.#{$rootName}-search-focus {
            width: 550px;
        }

        .#{$rootName}-tip {
            position: absolute;
            left: 50%;
            top: 0;
            transform: translate(-50%, 0);
            text-align: center;
            z-index: 2;
            height: 64px;
            display: flex;
            align-items: center;
            transition: .3s all;

            &.#{$rootName}-tip-left {
                left: 0;
                transform: translate(0, 0);
            }

            .#{$rootName}-tip-img {
                background: url('../search.png');
                width: 36px;
                height: 36px;
                margin-left: 15px;
                vertical-align: middle;
            }

            .#{$rootName}-placeholder {
                display: inline;
                font-size: 26px;
                color: #C9C9C9;
                margin-left: 10px;

                &.#{$rootName}-placeholder-hide {
                    display: none;
                }
            }
        }

        .#{$rootName}-input {
            width: 100%;
            height: 64px;
            border: none;
            opacity: 0;
            outline: none;
            font-size: 26px;
            color: #333333;
            position: absolute;
            top: 0;
            left: 0;
            background-color: transparent;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 3;
            padding-left: 55px;
            box-sizing: border-box;
        }
    }

    .#{$rootName}-search-focus {
        .#{$rootName}-input {
            opacity: 1;
        }
    }

    .#{$rootName}-cancle {
        width: 0;
        text-align: center;
        font-size: 30px;
        color: #999;
        line-height: 64px;
        opacity: 0;
        transition: .3s all;

        &.#{$rootName}-cancle-focus {
            width: 120px;
            opacity: 1;
        }
    }

    .#{$rootName}-btn {
        height: 64px;
        text-align: center;
        line-height: 64px;
        border-radius: 10px;
        background-color: #2196FE;
        font-size: 26px;
        color: #fff;
        margin-left: 10px;
        width: 0;

        &.#{$rootName}-focus {
            width: 100px;
        }
    }
}